
function doSave() {
    var ids=$('#jqGrid').jqGrid('getGridParam','selarrrow');//获得所有被选中的id
    var url = base + "/account/sk/authorization/insert";
    var accountId = $("#accountId").val();
    var roleIds = $("#roleIds").val().split(",");//...
    $.post(url, {ids:ids,roleIds:roleIds, accountId: accountId}, function (data) {
        $.messager.alert0({selector: "#indexAlert", type: data.code, html: data.message});
        if (data && data.code == 'SUCCESS') {
            tools.goto(base + "/account/view/index", 500);
        }
    })
}

function loadData(){
    var id=$("#accountId").val();
    $("#jqGrid").jqGrid($.extend(jqGrids.defaults,{
        url:base+ '/account/view/authorization/list?accountId='+id,
        colNames:[ '中文名称','英文名称','描述', '创建时间'],
        colModel: [
            {name:'name',index:'name',width:'90'},
            {name:'enname',index:'enname',width:'90'},
            {name:'description',index:'description',width:'90'},
            {name:'createTime',index:'createTime',formatter:tools.formatDate,width:'140'}
        ]
    }));
}

/**查询*/
function doSearch(){
    var name=$("input[name=name]").val();
    var ename=$("input[name=ename]").val();
    $("#jqGrid").jqGrid('setGridParam',{
        datatype:'json',
        postData:{'roleName':name,'ename':ename}, //发送数据
        page:0
    }).trigger("reloadGrid"); //重新载入
}

page_handlers.resize_handler=function(){
    jqGrids.auto_size();
};